//uart.h
#ifndef		__UART_H__
#define		__UART_H__

#include "TypeDefine.h"

#define		PROTOCOL1		1
#define		PROTOCOL2		2
#define		PROTOCOL3		3
#define		COM_PROTOCOL	PROTOCOL1

#define		RX_BUF_SIZE		100
#define		TX_BUF_SIZE		50

typedef struct
{
	uint8 buffer[TX_BUF_SIZE];
	uint8 write_index;
	uint8 send_index;
	uint8 state;
	uint8 cnt;
}uart_tx;

typedef struct
{
	uint8 buffer[RX_BUF_SIZE];
	uint8 read_index;
	uint8 save_index;
	uint8 cnt;
}uart_rx;

void U1_Init(void);
void U2_Init(void);

int8 U1_Sent(const uint8 *buf, uint8 size);
int8 U1_SentFrame(const uint8 *senddata, uint8 size);
int8 U1_Get(uint8 *Str, uint8 size);
int8 U1RX_Scan(void);
int8 U1TX_Scan(void);

#endif
